package at.jku.se.fastsell.db4o.transactions;

import at.jku.se.fastsell.db4o.DatabaseException;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.google.appengine.api.datastore.Query;

/**
 * Deletes all data in database
 */
public class ClearDatabaseTransaction extends Transaction<Void> {

	@Override
	public Void run() throws DatabaseException {
//
//		@SuppressWarnings("rawtypes")
//		ObjectSet objects = db.queryByExample(null);
//		for (Object o : objects) {
//			db.delete(o);
//		}
//		
//		db.commit();
//		
//		return null;
		
//		DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
//		datastore.delete((Iterable<Key>) datastore.getIndexes());
//		Key lastSeenKey = KeyFactory.createKey("FastSell", "FastSell");
		Query q =  new Query().addFilter(Entity.KEY_RESERVED_PROPERTY, Query.FilterOperator.GREATER_THAN, key);
		return null;
	}	

}
